﻿<?php
   //error_reporting(0);
   session_start();
   $title=$_POST["title"];
   $position=$_POST["position"];
   $industry=$_POST["industry"];
   $date_deadline=$_POST["date_deadline"];
   $place=$_POST["place"];
   $payment=$_POST["payment"];
   $job_attribute=$_POST["full_time"];
   $content=$_POST["content"];
   $id=$_POST["id"];
   include ("../class/filter.class.php");
   $myfilter=new filter();
   
   //处理标题
   $title=$myfilter->Filter_Input($title);
   $length=strlen($title);
   if($length<6)
   {
   	  echo '<script>alert("标题长度要在6位以上！");window.location.href="../company/Recruitment_add.php"</script>';
   	  exit();
   }
   
   //处理职位
   $position=$myfilter->Filter_Input($position);
   $length=strlen($position);
   if($length<1)
   {
   	  echo '<script>alert("职位不能为空！");window.location.href="../company/Recruitment_add.php"</script>';
   	  exit();
   }
   
   //处理行业选择
   $industry=$myfilter->Filter_Input($industry);
 
   //处理截止时间
   $date_deadline=$myfilter->Filter_Input($date_deadline);
   $date_deadline .= " 0:0:0";
   $date_time=strtotime($date_deadline);
   
   //处理工作地点
   $place=$myfilter->Filter_Input($place);
   
   //处理待遇
   $payment=$myfilter->Filter_Input($payment);
   $length=strlen($payment);
   if($length<1)
   {
   	   echo '<script>alert("待遇不能为空！");window.location.href="../company/Recruitment_add.php"</script>';
   	   exit();
   }
   
   //处理工作属性
   $job_attribute=$myfilter->Filter_Input($job_attribute);
   
   
   //处理内容
   $content=$myfilter->Filter_Input($content);
   $length=strlen($content);
   if($length<10)
   {
   	   echo '<script>alert("内容字数要大于10位！");window.location.href="../company/Recruitment_add.php"</script>';
   	   exit();
   }
   
   //字符串处理完毕
   //包含进招聘信息类

   include ("../class/employ_message.class.php");
   $date_public=time();
   $employ_message=new EmployMessage();
   $compay_id = (int)$_SESSION["Company_Id"];
   $newId=$employ_message->employ_message_Update($id,$title,$content,$compay_id,$date_public,$date_time,$position,$place,$payment,$job_attribute,$industry);
   if($newId>0)
   {
   	  echo '<script>window.location.href="../company/Recruitment_review.php?id_employMsg='.$newId.'";</script>';
   }
    else {
   	  echo '<script>alert("更新失败！");window.location.href="../company/Recruitment_change.php";</script>';
   }
   
  
?>